Add mythical code that would make sending tracks to GPS better if the devices
authorrobertl <robertl>
Sun, 5 Apr 2009 21:55:52 +0000 (21:55 +0000)
committerrobertl <robertl>
Sun, 5 Apr 2009 21:55:52 +0000 (21:55 +0000)
that used those packets actually supported receiving tracks - but they don't.
See definition of A301 on page 16 of Garmin spec.

jeeps/gpsapp.c
jeeps/gpsapp.h
jeeps/gpscom.c
jeeps/gpslibusb.c

index 1b8fa43909136c46d4489e14e061716790f0c58b..d87520e50a12aa583e39c645cef7fb33d1fb1484 100644 (file)
@@ -3833,6 +3833,11 @@ int32 GPS_A301_Send(const char *port, GPS_PTrack *trk, int32 n)
     if(gps_trk_transfer == -1)
        return GPS_UNSUPPORTED;
 
+    if(gps_trk_transfer == 302) {
+       GPS_Warning("A302: Device does not support sending tracks to it. ");
+       return GPS_UNSUPPORTED;
+    }
+
     /* Only those GPS' with L001 can send track data */
     if(!LINK_ID[gps_link_type].Pid_Trk_Data)
     {
@@ -3870,8 +3875,11 @@ int32 GPS_A301_Send(const char *port, GPS_PTrack *trk, int32 n)
            case pD312:
                GPS_D310_Send(data,trk[i],&len);
                break;
+           case pD311:
+               GPS_D311_Send(data,trk[i],&len);
+               break;
            default:
-               GPS_Error("A301_Send: Unknown track protocol");
+               GPS_Error("A301_Send: Unknown track protocol %d", gps_trk_hdr_type);
                return PROTOCOL_ERROR;
            }
        }
@@ -3886,13 +3894,16 @@ int32 GPS_A301_Send(const char *port, GPS_PTrack *trk, int32 n)
                len = 13;
                break;
            case pD301:
-           case pD302:
-               GPS_D301_Send(data,trk[i]);
+               GPS_D301_Send(data,trk[i], 301);
                len = 21;
                break;
+           case pD302:
+               GPS_D301_Send(data,trk[i], 302);
+               len = 25;
+               break;
            case pD304:
                GPS_D304_Send(data,trk[i]);
-               len = 26;
+               len = 23;
                break;
            default:
                GPS_Error("A301_Send: Unknown track protocol");
@@ -4276,7 +4287,7 @@ void GPS_D300_Send(UC *data, GPS_PTrack trk)
 **
 ** @return [void]
 ************************************************************************/
-void GPS_D301_Send(UC *data, GPS_PTrack trk)
+void GPS_D301_Send(UC *data, GPS_PTrack trk, int type)
 {
     UC *p;
 
@@ -4289,6 +4300,11 @@ void GPS_D301_Send(UC *data, GPS_PTrack trk)
     GPS_Util_Put_Float(p,trk->dpth);
     p+=sizeof(float);
 
+    if (type == 302) {
+      GPS_Util_Put_Float(p,1.0e25);
+      p+=sizeof(float);
+    }
+
     *p = trk->tnew;
 
     return;
@@ -4319,12 +4335,33 @@ void GPS_D304_Send(UC *data, GPS_PTrack trk)
     *p = trk->cadence > 0 ? trk->cadence : 0xff;
     p+=sizeof(char);
 
-    *p = trk->tnew;
-
     return;
 }
 
+/* @func GPS_D311_Send **************************************************
+**
+** Form track header data string
+**
+** @param [w] data [UC *] string to write to
+** @param [r] trk [GPS_PTrack] track data
+** @param [w] len [int32 *] length of data
+**
+** @return [void]
+************************************************************************/
+void GPS_D311_Send(UC *data, GPS_PTrack trk, int32 *len)
+{
+    UC *p;
+    int identifier;
 
+    p = data;
+//    sscanf(trk->trk_ident, "%d", &identifier);
+    identifier = 0x1234;
+    GPS_Util_Put_Short(p,identifier);
+    p += 2;
+    *len = p-data;
+
+    return;
+}
 
 /* @func GPS_D310_Send **************************************************
 **
index 677b448d98a6f90b6144febd5fc2be8148dda1e0..b303322d9a06085cb21e8972aead826fe01a15d4 100644 (file)
@@ -33,9 +33,10 @@ void   GPS_D303b_Get(GPS_PTrack *trk, UC *data); /*D304*/
 void   GPS_D310_Get(GPS_PTrack *trk, UC *s);
 void   GPS_D311_Get(GPS_PTrack *trk, UC *s);
 void   GPS_D300_Send(UC *data, GPS_PTrack trk);
-void   GPS_D301_Send(UC *data, GPS_PTrack trk);
+void   GPS_D301_Send(UC *data, GPS_PTrack trk, int type);
 void   GPS_D304_Send(UC *data, GPS_PTrack trk);
 void   GPS_D310_Send(UC *data, GPS_PTrack trk, int32 *len);
+void   GPS_D311_Send(UC *data, GPS_PTrack trk, int32 *len);
 
 int32  GPS_A400_Get(const char *port, GPS_PWay **way);
 int32  GPS_A400_Send(const char *port, GPS_PWay *way, int32 n);
index 3063b510afd7db5bbdd0e2e5d084a1d6e3c34f77..3c5276ec2b3225d469a55680d4752d040092bcad 100644 (file)
@@ -269,10 +269,11 @@ int32 GPS_Command_Send_Track(const char *port, GPS_PTrack *trk, int32 n)
        ret = GPS_A300_Send(port, trk, n);
        break;
     case pA301:
+    case pA302:
        ret = GPS_A301_Send(port, trk, n);
        break;
     default:
-       GPS_Error("Send_Track: Unknown track protocol");
+       GPS_Error("Send_Track: Unknown track protocol %d.", gps_trk_transfer);
        break;
     }
 
index 3397c2c7b54d1576b680a2644221897be738e126..34872d6951dc002180bb19d836011d06d5cf7c7f 100644 (file)
@@ -338,7 +338,9 @@ garmin_usb_start(struct usb_device *dev, libusb_unit_data *lud)
                        // It's a case instead of an 'if' becuase I have a 
                        // feeling there are more affected models either
                        // on the market or on the way.
-                       case 695: break;
+                       case 695: break;   // Venture HC
+                       case 285: break;   // GPSMap 276C/4.80
+                       case 402: break;   // GPSMap 396C/4.50
                        default: gusb_syncup();
                }
                return;